<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Modbus 插件 | 美的楼宇科技研究院</title>
    <meta name="generator" content="VuePress 1.9.5">
    <link rel="icon" href="/img/favicon.ico">
    <meta name="description" content="iBUILDING作为智慧建筑的数字践行者，致力于用数字的眼光建筑世界。以科技赋能楼宇，构建数字建筑生态，共创更美好的智慧空间。Make iBUILDING come TRUE。">
    <meta name="keywords" content="iBUILDING,ibuilding">
    <meta name="theme-color" content="#11a8cd">
    <meta name="baidu-site-verification" content="code-j1XZ46JIBR">
    
    <link rel="preload" href="/assets/css/0.styles.af9b49f9.css" as="style"><link rel="preload" href="/assets/js/app.ffe9b366.js" as="script"><link rel="preload" href="/assets/js/2.9760a328.js" as="script"><link rel="preload" href="/assets/js/19.4957cef9.js" as="script"><link rel="prefetch" href="/assets/js/10.1ca8e9a5.js"><link rel="prefetch" href="/assets/js/11.f84ca260.js"><link rel="prefetch" href="/assets/js/12.5d62fb57.js"><link rel="prefetch" href="/assets/js/13.3fd35f26.js"><link rel="prefetch" href="/assets/js/14.d428d44b.js"><link rel="prefetch" href="/assets/js/15.752b1e82.js"><link rel="prefetch" href="/assets/js/16.f33da816.js"><link rel="prefetch" href="/assets/js/17.4a25f92e.js"><link rel="prefetch" href="/assets/js/18.3ad538ff.js"><link rel="prefetch" href="/assets/js/20.264d8716.js"><link rel="prefetch" href="/assets/js/21.2e6c7b77.js"><link rel="prefetch" href="/assets/js/22.4abc22b5.js"><link rel="prefetch" href="/assets/js/23.52e85444.js"><link rel="prefetch" href="/assets/js/24.ae24e643.js"><link rel="prefetch" href="/assets/js/25.5596a9ad.js"><link rel="prefetch" href="/assets/js/26.d952969d.js"><link rel="prefetch" href="/assets/js/27.7711bd91.js"><link rel="prefetch" href="/assets/js/3.0b2e2ac4.js"><link rel="prefetch" href="/assets/js/4.d41f70ee.js"><link rel="prefetch" href="/assets/js/5.603be3f5.js"><link rel="prefetch" href="/assets/js/6.36f53e66.js"><link rel="prefetch" href="/assets/js/7.8566b5df.js"><link rel="prefetch" href="/assets/js/8.82830ba8.js"><link rel="prefetch" href="/assets/js/9.d949e13c.js">
    <link rel="stylesheet" href="/assets/css/0.styles.af9b49f9.css">
  </head>
  <body class="theme-mode-light">
    <div id="app" data-server-rendered="true"><div class="theme-container sidebar-open have-rightmenu"><header class="navbar blur"><div title="目录" class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="https://static-btri.midea.com/mfs/1001/1656483801940.svg" alt="美的楼宇科技研究院" class="logo"> <span class="site-name can-hide">美的楼宇科技研究院</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="📖开源项目" class="dropdown-title"><!----> <span class="title" style="display:;">📖开源项目</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/driver-box/" class="nav-link">driver-box</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="开发者社区" class="dropdown-title"><!----> <span class="title" style="display:;">开发者社区</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/blog/about.html" class="nav-link">技术博客</a></li><li class="dropdown-item"><!----> <a href="https://openibuilding.midea.com/home" target="_blank" rel="noopener noreferrer" class="nav-link external">
  开放平台
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="开源仓库" class="dropdown-title"><!----> <span class="title" style="display:;">开源仓库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://gitee.com/iBUILDING-X" target="_blank" rel="noopener noreferrer" class="nav-link external">
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <div class="sidebar-hover-trigger"></div> <aside class="sidebar" style="display:none;"><!----> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="📖开源项目" class="dropdown-title"><!----> <span class="title" style="display:;">📖开源项目</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/driver-box/" class="nav-link">driver-box</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="开发者社区" class="dropdown-title"><!----> <span class="title" style="display:;">开发者社区</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/blog/about.html" class="nav-link">技术博客</a></li><li class="dropdown-item"><!----> <a href="https://openibuilding.midea.com/home" target="_blank" rel="noopener noreferrer" class="nav-link external">
  开放平台
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="开源仓库" class="dropdown-title"><!----> <span class="title" style="display:;">开源仓库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://gitee.com/iBUILDING-X" target="_blank" rel="noopener noreferrer" class="nav-link external">
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav>  <ul class="sidebar-links"><li><a href="/driver-box/" class="sidebar-link">driver-box</a></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>用户手册</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/driver-box/quick_start/" class="sidebar-link">快速开始</a></li><li><a href="/driver-box/guides/config/" class="sidebar-link">配置说明</a></li><li><a href="/pages/8e66ec/" class="sidebar-link">HTTP Client 插件</a></li><li><a href="/pages/3162cd/" class="sidebar-link">HTTP Server 插件</a></li><li><a href="/pages/f8d682/" aria-current="page" class="active sidebar-link">Modbus 插件</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level2"><a href="/pages/f8d682/#协议支持" class="sidebar-link">协议支持</a></li><li class="sidebar-sub-header level2"><a href="/pages/f8d682/#配置文件" class="sidebar-link">配置文件</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/f8d682/#点位扩展-devicepoints" class="sidebar-link">点位扩展（devicePoints）</a></li><li class="sidebar-sub-header level3"><a href="/pages/f8d682/#设备扩展-protocol" class="sidebar-link">设备扩展（protocol）</a></li><li class="sidebar-sub-header level3"><a href="/pages/f8d682/#连接配置" class="sidebar-link">连接配置</a></li><li class="sidebar-sub-header level3"><a href="/pages/f8d682/#扩展参数-定时任务" class="sidebar-link">扩展参数-定时任务</a></li><li class="sidebar-sub-header level3"><a href="/pages/f8d682/#配置示例" class="sidebar-link">配置示例</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/f8d682/#动态脚本" class="sidebar-link">动态脚本</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/f8d682/#encode-函数" class="sidebar-link">encode 函数</a></li><li class="sidebar-sub-header level4"><a href="/pages/f8d682/#示例" class="sidebar-link">示例</a></li><li class="sidebar-sub-header level4"><a href="/pages/f8d682/#参数" class="sidebar-link">参数</a></li><li class="sidebar-sub-header level3"><a href="/pages/f8d682/#decode-函数" class="sidebar-link">decode 函数</a></li><li class="sidebar-sub-header level4"><a href="/pages/f8d682/#示例-2" class="sidebar-link">示例</a></li><li class="sidebar-sub-header level4"><a href="/pages/f8d682/#参数-2" class="sidebar-link">参数</a></li></ul></li></ul></li><li><a href="/pages/4fcadc/" class="sidebar-link">BACnet 插件</a></li><li><a href="/pages/417ad9/" class="sidebar-link">MQTT 插件</a></li><li><a href="/pages/312d09/" class="sidebar-link">TCP Server 插件</a></li><li><a href="/pages/28a924/" class="sidebar-link">脚本内置模块</a></li><li><a href="/pages/da9d86/" class="sidebar-link">RESTful API</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>开发者手册</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/driver-box/dev/compile_run/" class="sidebar-link">编译运行</a></li><li><a href="/driver-box/dev/release/" class="sidebar-link">发版记录</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>设计思路</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/pages/design/concept/" class="sidebar-link">相关概念</a></li><li><a href="/pages/design/structure/" class="sidebar-link">系统架构</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>设备实战</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/pages/674f6d/" class="sidebar-link">厕所门把手</a></li></ul></section></li></ul> </aside> <div><main class="page"><div class="theme-vdoing-wrapper "><div class="articleInfo-wrap" data-v-06225672><div class="articleInfo" data-v-06225672><ul class="breadcrumbs" data-v-06225672><li data-v-06225672><a href="/" title="首页" class="iconfont icon-home router-link-active" data-v-06225672></a></li> <li data-v-06225672><span data-v-06225672>driver-box</span></li><li data-v-06225672><span data-v-06225672>用户手册</span></li></ul> <div class="info" data-v-06225672><div title="作者" class="author iconfont icon-touxiang" data-v-06225672><a href="javascript:;" data-v-06225672>爱丁</a></div> <div title="创建时间" class="date iconfont icon-riqi" data-v-06225672><a href="javascript:;" data-v-06225672>2023-03-31</a></div> <!----></div></div></div> <!----> <div class="content-wrapper"><div class="right-menu-wrapper"><div class="right-menu-margin"><div class="right-menu-title">目录</div> <div class="right-menu-content"></div></div></div> <h1><img src="">Modbus 插件<!----></h1> <div class="page-slot page-slot-top">
    <div class="wwads-cn wwads-horizontal page-wwads" data-id="136"></div>
    <style>
      .page-wwads{
        width:100%!important;
        min-height: 0;
        margin: 0;
      }
      .page-wwads .wwads-img img{
        width:80px!important;
      }
      .page-wwads .wwads-poweredby{
        width: 40px;
        position: absolute;
        right: 25px;
        bottom: 3px;
      }
      .wwads-content .wwads-text, .page-wwads .wwads-text{
        height: 100%;
        padding-top: 5px;
        display: block;
      }
  </style>
  </div> <div class="theme-vdoing-content content__default"><h1 id="modbus-插件"><a href="#modbus-插件" class="header-anchor">#</a> Modbus 插件</h1> <h2 id="协议支持"><a href="#协议支持" class="header-anchor">#</a> 协议支持</h2> <ul><li>rtu mode</li> <li>tcp mode</li> <li>udp mode</li> <li>rtuovertcp mode</li> <li>rtuoverudp mode</li> <li>tcp+tls mode</li></ul> <h2 id="配置文件"><a href="#配置文件" class="header-anchor">#</a> 配置文件</h2> <h3 id="点位扩展-devicepoints"><a href="#点位扩展-devicepoints" class="header-anchor">#</a> 点位扩展（devicePoints）</h3> <table><thead><tr><th>key</th> <th>valueType</th> <th>描述</th></tr></thead> <tbody><tr><td>primaryTable</td> <td>string</td> <td>寄存器类型：COIL、DISCRETE_INPUT、INPUT_REGISTER、HOLDING_REGISTER</td></tr> <tr><td>startAddress</td> <td>int</td> <td>起始地址，例如：0</td></tr> <tr><td>quantity</td> <td>int</td> <td>读取寄存器数量，例如：1</td></tr> <tr><td>rawType</td> <td>string</td> <td>原始数据类型：Int16、Int32、Int64、Uint16、Uint32、Uint64、Float32、Float64、String</td></tr></tbody></table> <h3 id="设备扩展-protocol"><a href="#设备扩展-protocol" class="header-anchor">#</a> 设备扩展（protocol）</h3> <table><thead><tr><th>key</th> <th>valueType</th> <th>描述</th></tr></thead> <tbody><tr><td>unitID</td> <td>string</td> <td>modbus slaveID</td></tr></tbody></table> <h3 id="连接配置"><a href="#连接配置" class="header-anchor">#</a> 连接配置</h3> <table><thead><tr><th>key</th> <th>类型</th> <th style="text-align:center;">是否必填</th> <th>描述</th></tr></thead> <tbody><tr><td>address</td> <td>string</td> <td style="text-align:center;">Y</td> <td>modbus连接地址</td></tr> <tr><td>mode</td> <td>string</td> <td style="text-align:center;">Y</td> <td>modbus连接模式：tcp、rtu、udp、rutovertcp、rtuoverudp、tcp+tls</td></tr> <tr><td>timeout</td> <td>int</td> <td style="text-align:center;">N</td> <td>超时时间</td></tr></tbody></table> <h3 id="扩展参数-定时任务"><a href="#扩展参数-定时任务" class="header-anchor">#</a> 扩展参数-定时任务</h3> <table><thead><tr><th>key</th> <th>类型</th> <th>描述</th></tr></thead> <tbody><tr><td>devices</td> <td>[]string</td> <td>设备列表</td></tr> <tr><td>points</td> <td>[]string</td> <td>点位列表</td></tr></tbody></table> <h3 id="配置示例"><a href="#配置示例" class="header-anchor">#</a> 配置示例</h3> <details class="custom-block details"><summary>点击查看</summary> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
  <span class="token property">&quot;deviceModels&quot;</span><span class="token operator">:</span><span class="token punctuation">[</span>
    <span class="token punctuation">{</span>
      <span class="token property">&quot;name&quot;</span><span class="token operator">:</span><span class="token string">&quot;xfxt&quot;</span><span class="token punctuation">,</span>
      <span class="token property">&quot;modelId&quot;</span><span class="token operator">:</span> <span class="token string">&quot;xfxt&quot;</span><span class="token punctuation">,</span>
      <span class="token property">&quot;description&quot;</span><span class="token operator">:</span><span class="token string">&quot;新风系统-空调控制面板&quot;</span><span class="token punctuation">,</span>
      <span class="token property">&quot;devicePoints&quot;</span><span class="token operator">:</span><span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
          <span class="token property">&quot;name&quot;</span><span class="token operator">:</span><span class="token string">&quot;RoomTemp&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;description&quot;</span><span class="token operator">:</span><span class="token string">&quot;室内温度&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;valueType&quot;</span><span class="token operator">:</span><span class="token string">&quot;int&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;readWrite&quot;</span><span class="token operator">:</span><span class="token string">&quot;R&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;reportMode&quot;</span><span class="token operator">:</span><span class="token string">&quot;change&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;timerReport&quot;</span><span class="token operator">:</span><span class="token string">&quot;15m&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;realReport&quot;</span><span class="token operator">:</span><span class="token boolean">true</span><span class="token punctuation">,</span>
          <span class="token property">&quot;primaryTable&quot;</span><span class="token operator">:</span> <span class="token string">&quot;HOLDING_REGISTER&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;startAddress&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
          <span class="token property">&quot;quantity&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
          <span class="token property">&quot;rawType&quot;</span><span class="token operator">:</span> <span class="token string">&quot;Int16&quot;</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
          <span class="token property">&quot;name&quot;</span><span class="token operator">:</span><span class="token string">&quot;RoomSetTemp&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;description&quot;</span><span class="token operator">:</span><span class="token string">&quot;温湿度设定&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;valueType&quot;</span><span class="token operator">:</span><span class="token string">&quot;int&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;readWrite&quot;</span><span class="token operator">:</span><span class="token string">&quot;RW&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;reportMode&quot;</span><span class="token operator">:</span><span class="token string">&quot;change&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;timerReport&quot;</span><span class="token operator">:</span><span class="token string">&quot;15m&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;realReport&quot;</span><span class="token operator">:</span><span class="token boolean">true</span><span class="token punctuation">,</span>
          <span class="token property">&quot;primaryTable&quot;</span><span class="token operator">:</span> <span class="token string">&quot;HOLDING_REGISTER&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;startAddress&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
          <span class="token property">&quot;quantity&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
          <span class="token property">&quot;rawType&quot;</span><span class="token operator">:</span> <span class="token string">&quot;Int16&quot;</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
          <span class="token property">&quot;name&quot;</span><span class="token operator">:</span><span class="token string">&quot;FanSwitchR&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;description&quot;</span><span class="token operator">:</span><span class="token string">&quot;风扇转速反馈&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;valueType&quot;</span><span class="token operator">:</span><span class="token string">&quot;int&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;readWrite&quot;</span><span class="token operator">:</span><span class="token string">&quot;R&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;reportMode&quot;</span><span class="token operator">:</span><span class="token string">&quot;change&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;timerReport&quot;</span><span class="token operator">:</span><span class="token string">&quot;15m&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;realReport&quot;</span><span class="token operator">:</span><span class="token boolean">true</span><span class="token punctuation">,</span>
          <span class="token property">&quot;primaryTable&quot;</span><span class="token operator">:</span> <span class="token string">&quot;HOLDING_REGISTER&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;startAddress&quot;</span><span class="token operator">:</span> <span class="token number">4</span><span class="token punctuation">,</span>
          <span class="token property">&quot;quantity&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
          <span class="token property">&quot;rawType&quot;</span><span class="token operator">:</span> <span class="token string">&quot;Int16&quot;</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
          <span class="token property">&quot;name&quot;</span><span class="token operator">:</span><span class="token string">&quot;FanSwitch&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;description&quot;</span><span class="token operator">:</span><span class="token string">&quot;风扇转速&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;valueType&quot;</span><span class="token operator">:</span><span class="token string">&quot;int&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;readWrite&quot;</span><span class="token operator">:</span><span class="token string">&quot;RW&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;reportMode&quot;</span><span class="token operator">:</span><span class="token string">&quot;change&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;timerReport&quot;</span><span class="token operator">:</span><span class="token string">&quot;15m&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;realReport&quot;</span><span class="token operator">:</span><span class="token boolean">true</span><span class="token punctuation">,</span>
          <span class="token property">&quot;primaryTable&quot;</span><span class="token operator">:</span> <span class="token string">&quot;HOLDING_REGISTER&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;startAddress&quot;</span><span class="token operator">:</span> <span class="token number">5</span><span class="token punctuation">,</span>
          <span class="token property">&quot;quantity&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
          <span class="token property">&quot;rawType&quot;</span><span class="token operator">:</span> <span class="token string">&quot;Int16&quot;</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
          <span class="token property">&quot;name&quot;</span><span class="token operator">:</span><span class="token string">&quot;ModeSwitch&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;description&quot;</span><span class="token operator">:</span><span class="token string">&quot;运行模式&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;valueType&quot;</span><span class="token operator">:</span><span class="token string">&quot;int&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;readWrite&quot;</span><span class="token operator">:</span><span class="token string">&quot;RW&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;reportMode&quot;</span><span class="token operator">:</span><span class="token string">&quot;change&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;timerReport&quot;</span><span class="token operator">:</span><span class="token string">&quot;15m&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;realReport&quot;</span><span class="token operator">:</span><span class="token boolean">true</span><span class="token punctuation">,</span>
          <span class="token property">&quot;primaryTable&quot;</span><span class="token operator">:</span> <span class="token string">&quot;HOLDING_REGISTER&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;startAddress&quot;</span><span class="token operator">:</span> <span class="token number">3</span><span class="token punctuation">,</span>
          <span class="token property">&quot;quantity&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
          <span class="token property">&quot;rawType&quot;</span><span class="token operator">:</span> <span class="token string">&quot;Int16&quot;</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
          <span class="token property">&quot;name&quot;</span><span class="token operator">:</span><span class="token string">&quot;ValueSta&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;description&quot;</span><span class="token operator">:</span><span class="token string">&quot;水阀状态&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;valueType&quot;</span><span class="token operator">:</span><span class="token string">&quot;int&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;readWrite&quot;</span><span class="token operator">:</span><span class="token string">&quot;R&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;reportMode&quot;</span><span class="token operator">:</span><span class="token string">&quot;change&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;timerReport&quot;</span><span class="token operator">:</span><span class="token string">&quot;15m&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;realReport&quot;</span><span class="token operator">:</span><span class="token boolean">true</span><span class="token punctuation">,</span>
          <span class="token property">&quot;primaryTable&quot;</span><span class="token operator">:</span> <span class="token string">&quot;HOLDING_REGISTER&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;startAddress&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
          <span class="token property">&quot;quantity&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
          <span class="token property">&quot;rawType&quot;</span><span class="token operator">:</span> <span class="token string">&quot;Int16&quot;</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
          <span class="token property">&quot;name&quot;</span><span class="token operator">:</span><span class="token string">&quot;RunStatus&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;description&quot;</span><span class="token operator">:</span><span class="token string">&quot;开关状态&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;valueType&quot;</span><span class="token operator">:</span><span class="token string">&quot;int&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;readWrite&quot;</span><span class="token operator">:</span><span class="token string">&quot;RW&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;reportMode&quot;</span><span class="token operator">:</span><span class="token string">&quot;change&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;timerReport&quot;</span><span class="token operator">:</span><span class="token string">&quot;15m&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;realReport&quot;</span><span class="token operator">:</span><span class="token boolean">true</span><span class="token punctuation">,</span>
          <span class="token property">&quot;primaryTable&quot;</span><span class="token operator">:</span> <span class="token string">&quot;HOLDING_REGISTER&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;startAddress&quot;</span><span class="token operator">:</span> <span class="token number">6</span><span class="token punctuation">,</span>
          <span class="token property">&quot;quantity&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
          <span class="token property">&quot;rawType&quot;</span><span class="token operator">:</span> <span class="token string">&quot;Int16&quot;</span>
        <span class="token punctuation">}</span>
      <span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token property">&quot;deviceActions&quot;</span><span class="token operator">:</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token property">&quot;devices&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
          <span class="token property">&quot;name&quot;</span><span class="token operator">:</span><span class="token string">&quot;sensor_1&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;description&quot;</span><span class="token operator">:</span><span class="token string">&quot;空调控制面板&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;connectionKey&quot;</span><span class="token operator">:</span><span class="token string">&quot;common&quot;</span><span class="token punctuation">,</span>
          <span class="token property">&quot;protocol&quot;</span><span class="token operator">:</span><span class="token punctuation">{</span>
            <span class="token property">&quot;unitID&quot;</span><span class="token operator">:</span> <span class="token string">&quot;2&quot;</span>
          <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
      <span class="token punctuation">]</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">]</span><span class="token punctuation">,</span>
  <span class="token property">&quot;timerTasks&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
    <span class="token punctuation">{</span>
      <span class="token property">&quot;interval&quot;</span><span class="token operator">:</span> <span class="token string">&quot;3000&quot;</span><span class="token punctuation">,</span>
      <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;read_points&quot;</span><span class="token punctuation">,</span>
      <span class="token property">&quot;action&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
          <span class="token property">&quot;devices&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
            <span class="token string">&quot;sensor_1&quot;</span>
          <span class="token punctuation">]</span><span class="token punctuation">,</span>
          <span class="token property">&quot;points&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
            <span class="token string">&quot;RoomTemp&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;RoomSetTemp&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;FanSwitchR&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;FanSwitch&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;ModeSwitch&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;ValueSta&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;RunStatus&quot;</span>
          <span class="token punctuation">]</span>
        <span class="token punctuation">}</span>
      <span class="token punctuation">]</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">]</span><span class="token punctuation">,</span>
  <span class="token property">&quot;connections&quot;</span><span class="token operator">:</span><span class="token punctuation">{</span>
    <span class="token property">&quot;common&quot;</span><span class="token operator">:</span><span class="token punctuation">{</span>
      <span class="token property">&quot;address&quot;</span><span class="token operator">:</span> <span class="token string">&quot;192.168.1.11:502&quot;</span><span class="token punctuation">,</span>
      <span class="token property">&quot;mode&quot;</span><span class="token operator">:</span> <span class="token string">&quot;tcp&quot;</span><span class="token punctuation">,</span>
      <span class="token property">&quot;timeout&quot;</span><span class="token operator">:</span> <span class="token number">3000</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token property">&quot;protocolName&quot;</span><span class="token operator">:</span><span class="token string">&quot;modbus&quot;</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br><span class="line-number">62</span><br><span class="line-number">63</span><br><span class="line-number">64</span><br><span class="line-number">65</span><br><span class="line-number">66</span><br><span class="line-number">67</span><br><span class="line-number">68</span><br><span class="line-number">69</span><br><span class="line-number">70</span><br><span class="line-number">71</span><br><span class="line-number">72</span><br><span class="line-number">73</span><br><span class="line-number">74</span><br><span class="line-number">75</span><br><span class="line-number">76</span><br><span class="line-number">77</span><br><span class="line-number">78</span><br><span class="line-number">79</span><br><span class="line-number">80</span><br><span class="line-number">81</span><br><span class="line-number">82</span><br><span class="line-number">83</span><br><span class="line-number">84</span><br><span class="line-number">85</span><br><span class="line-number">86</span><br><span class="line-number">87</span><br><span class="line-number">88</span><br><span class="line-number">89</span><br><span class="line-number">90</span><br><span class="line-number">91</span><br><span class="line-number">92</span><br><span class="line-number">93</span><br><span class="line-number">94</span><br><span class="line-number">95</span><br><span class="line-number">96</span><br><span class="line-number">97</span><br><span class="line-number">98</span><br><span class="line-number">99</span><br><span class="line-number">100</span><br><span class="line-number">101</span><br><span class="line-number">102</span><br><span class="line-number">103</span><br><span class="line-number">104</span><br><span class="line-number">105</span><br><span class="line-number">106</span><br><span class="line-number">107</span><br><span class="line-number">108</span><br><span class="line-number">109</span><br><span class="line-number">110</span><br><span class="line-number">111</span><br><span class="line-number">112</span><br><span class="line-number">113</span><br><span class="line-number">114</span><br><span class="line-number">115</span><br><span class="line-number">116</span><br><span class="line-number">117</span><br><span class="line-number">118</span><br><span class="line-number">119</span><br><span class="line-number">120</span><br><span class="line-number">121</span><br><span class="line-number">122</span><br><span class="line-number">123</span><br><span class="line-number">124</span><br><span class="line-number">125</span><br><span class="line-number">126</span><br><span class="line-number">127</span><br><span class="line-number">128</span><br><span class="line-number">129</span><br><span class="line-number">130</span><br><span class="line-number">131</span><br><span class="line-number">132</span><br><span class="line-number">133</span><br><span class="line-number">134</span><br><span class="line-number">135</span><br><span class="line-number">136</span><br><span class="line-number">137</span><br></div></div></details> <h2 id="动态脚本"><a href="#动态脚本" class="header-anchor">#</a> 动态脚本</h2> <h3 id="encode-函数"><a href="#encode-函数" class="header-anchor">#</a> encode 函数</h3> <h4 id="示例"><a href="#示例" class="header-anchor">#</a> 示例</h4> <div class="language-lua line-numbers-mode"><pre class="language-lua"><code><span class="token keyword">local</span> json <span class="token operator">=</span> http<span class="token punctuation">.</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&quot;json&quot;</span><span class="token punctuation">)</span>

<span class="token keyword">function</span> <span class="token function">encode</span><span class="token punctuation">(</span>deviceName<span class="token punctuation">,</span> raw<span class="token punctuation">)</span>
    <span class="token keyword">local</span> data <span class="token operator">=</span> json<span class="token punctuation">.</span><span class="token function">decode</span><span class="token punctuation">(</span>raw<span class="token punctuation">)</span>
    <span class="token function">print</span><span class="token punctuation">(</span>data<span class="token punctuation">.</span>name<span class="token punctuation">)</span>
    <span class="token function">print</span><span class="token punctuation">(</span>data<span class="token punctuation">.</span>targetValue<span class="token punctuation">)</span>
    <span class="token function">print</span><span class="token punctuation">(</span>data<span class="token punctuation">.</span>values<span class="token punctuation">)</span>
<span class="token keyword">end</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div><h4 id="参数"><a href="#参数" class="header-anchor">#</a> 参数</h4> <ul><li>deviceName（设备名称）</li> <li>raw</li></ul> <p><strong>raw</strong></p> <table><thead><tr><th>名称</th> <th>数据类型</th> <th>描述</th></tr></thead> <tbody><tr><td>name</td> <td>string</td> <td>设备名称</td></tr> <tr><td>targetValue</td> <td>string</td> <td>需要设定的值</td></tr> <tr><td>values</td> <td>[]any</td> <td>根据rawType编码出的寄存器值</td></tr></tbody></table> <p><strong>raw.values</strong></p> <table><thead><tr><th>名称</th> <th>数据类型</th> <th>描述</th></tr></thead> <tbody><tr><td>value</td> <td>uint16</td> <td>寄存器值</td></tr> <tr><td>mask</td> <td>string</td> <td>掩码  为 0 时无效</td></tr></tbody></table> <h3 id="decode-函数"><a href="#decode-函数" class="header-anchor">#</a> decode 函数</h3> <h4 id="示例-2"><a href="#示例-2" class="header-anchor">#</a> 示例</h4> <div class="language-lua line-numbers-mode"><pre class="language-lua"><code><span class="token keyword">local</span> json <span class="token operator">=</span> http<span class="token punctuation">.</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&quot;json&quot;</span><span class="token punctuation">)</span>

<span class="token keyword">function</span> <span class="token function">decode</span><span class="token punctuation">(</span>raw<span class="token punctuation">)</span>
    <span class="token keyword">local</span> data <span class="token operator">=</span> json<span class="token punctuation">.</span><span class="token function">decode</span><span class="token punctuation">(</span>raw<span class="token punctuation">)</span>
    <span class="token function">print</span><span class="token punctuation">(</span>data<span class="token punctuation">.</span>deviceName<span class="token punctuation">)</span>
    <span class="token function">print</span><span class="token punctuation">(</span>data<span class="token punctuation">.</span>points<span class="token punctuation">)</span>
<span class="token keyword">end</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br></div></div><h4 id="参数-2"><a href="#参数-2" class="header-anchor">#</a> 参数</h4> <ul><li>raw（设备点为相关数据）</li></ul> <p><strong>raw</strong></p> <table><thead><tr><th>名称</th> <th>数据类型</th> <th>描述</th></tr></thead> <tbody><tr><td>deviceName</td> <td>string</td> <td>设备名称</td></tr> <tr><td>points</td> <td>[]any</td> <td>点位数据</td></tr></tbody></table> <p><strong>raw.points</strong></p> <table><thead><tr><th>名称</th> <th>数据类型</th> <th>描述</th></tr></thead> <tbody><tr><td>name</td> <td>string</td> <td>设备名称</td></tr> <tr><td>rawValues</td> <td>[]uint16</td> <td>原始数据，按照寄存器顺序排列</td></tr> <tr><td>value</td> <td>any</td> <td>按照标准类型解析后的数据</td></tr></tbody></table></div></div>  <div class="page-edit"><!----> <!----> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2023/08/14, 11:31:29</span></div></div> <div class="page-nav-wapper"><div class="page-nav-centre-wrap"><a href="/pages/3162cd/" class="page-nav-centre page-nav-centre-prev"><div class="tooltip">HTTP Server 插件</div></a> <a href="/pages/4fcadc/" class="page-nav-centre page-nav-centre-next"><div class="tooltip">BACnet 插件</div></a></div> <div class="page-nav"><p class="inner"><span class="prev">
        ←
        <a href="/pages/3162cd/" class="prev">HTTP Server 插件</a></span> <span class="next"><a href="/pages/4fcadc/">BACnet 插件</a>→
      </span></p></div></div></div> <!----></main></div> <div class="footer"><div class="icons"><a href="https://gitee.com/iBUILDING-X" title="Gitee" target="_blank" class="iconfont icon-gitee"></a></div> 
  Theme by
  <a href="https://github.com/xugaoyi/vuepress-theme-vdoing" target="_blank" title="本站主题">Vdoing</a> 
    | Copyright © 2023-2023
    <span>iBUILDING</span></div> <div class="buttons"><div title="返回顶部" class="button blur go-to-top iconfont icon-fanhuidingbu" style="display:none;"></div> <div title="去评论" class="button blur go-to-comment iconfont icon-pinglun" style="display:none;"></div> <div title="主题模式" class="button blur theme-mode-but iconfont icon-zhuti"><ul class="select-box" style="display:none;"><li class="iconfont icon-zidong">
          跟随系统
        </li><li class="iconfont icon-rijianmoshi">
          浅色模式
        </li><li class="iconfont icon-yejianmoshi">
          深色模式
        </li><li class="iconfont icon-yuedu">
          阅读模式
        </li></ul></div></div> <!----> <!----> <!----></div><div class="global-ui"></div></div>
    <script src="/assets/js/app.ffe9b366.js" defer></script><script src="/assets/js/2.9760a328.js" defer></script><script src="/assets/js/19.4957cef9.js" defer></script>
  </body>
</html>
